/*
 *
 *  * Copyright (c) 2024 China Unicom Digital Technology Co., Ltd.
 *  * openFuyao is licensed under Mulan PSL v2.
 *  * You can use this software according to the terms and conditions of the Mulan PSL v2.
 *  * You may obtain a copy of Mulan PSL v2 at:
 *  *          http://license.coscl.org.cn/MulanPSL2
 *  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 *  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 *  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *  * See the Mulan PSL v2 for more details.
 *
 */

package recommend

import (
	"testing"

	"k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	"k8s.io/klog/v2"
)

func TestResourceSub(t *testing.T) {
	klog.Info("Hello TestResourceSub")

	//  "TestResourceSub" allocatable={"cpu":"32","memory":"131803812Ki"}
	// estimated={"cpu":"4894m","memory":"566201231"} recommended={"cpu":"27106m","memory":"134400902257"}
	allocatable := v1.ResourceList{
		v1.ResourceCPU:    *resource.NewQuantity(32, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(131803812*1024, resource.BinarySI),
	}
	estimated := v1.ResourceList{
		v1.ResourceCPU:    *resource.NewMilliQuantity(4894, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(566201231, resource.BinarySI),
	}
	recommended := v1.ResourceList{
		v1.ResourceCPU:    *resource.NewMilliQuantity(27106, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(134400902257, resource.BinarySI),
	}
	klog.InfoS("TestResourceSub", "allocatable", allocatable,
		"estimated", estimated, "recommended", recommended)
}
